var itemid;
var acc;
var avoid; 
var dex; 
var hands; 
var hp; 
var intt; 
var jump; 
var level; 
var luk; 
var matk; 
var mdef; 
var mp; 
var speed; 
var str; 
var watk; 
var wdef; 
var upgradeslots;

var status = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}
 
function action(mode, type, selection) {
	if (mode == -1) {
        	cm.dispose();
	} else {
        	if (mode == 0) {
			cm.sendOk("Bye Gm, smell ya later <3");
	        	cm.dispose();
        		return;
        	}
        	if (mode == 1)
            		status++;
        	else
            		status--;
	        if (status == 0) {
			if (!cm.getChar().isGM()) {
				cm.sendOk("Lol, i only create equips for Gm's <3");
				cm.dispose();
			} else { 
				cm.sendYesNo("Hello there GM\r\nBas has hired me to create equips! Do you want a nice randomised Equip?");
			}
		} else if (status == 1) {
			cm.sendGetText("What is the id of the item?");
		} else if (status == 2) {
			itemid = cm.getText();
			cm.sendGetText("And how much acc must #v" + itemid + "# have?");
		} else if (status == 3) {
			acc = cm.getText();
			cm.sendGetText("And how much avoid must #v" + itemid + "# have?");
		} else if (status == 4) {
			avoid = cm.getText();
			cm.sendGetText("And how much dex must #v" + itemid + "# have?");
		} else if (status == 5) {
			dex = cm.getText();
			cm.sendGetText("And how much hands must #v" + itemid + "# have?");
		} else if (status == 6) {
			hands = cm.getText();
			cm.sendGetText("And how much hp must #v" + itemid + "# have?");
		} else if (status == 7) {
			hp = cm.getText();
			cm.sendGetText("And how much int must #v" + itemid + "# have?");
		} else if (status == 8) {
			intt = cm.getText();
			cm.sendGetText("And how much jump must #v" + itemid + "# have?");
		} else if (status == 9) {
			jump = cm.getText();
			cm.sendGetText("And what level must #v" + itemid + "# be?");
		} else if (status == 10) {
			level = cm.getText();
			cm.sendGetText("And how much luk must #v" + itemid + "# have?");
		} else if (status == 11) {
			luk = cm.getText();
			cm.sendGetText("And how much magic attack must #v" + itemid + "# have?");
		} else if (status == 12) {
			matk = cm.getText();
			cm.sendGetText("And how much magic defence must #v" + itemid + "# have?");
		} else if (status == 13) {
			mdef = cm.getText();
			cm.sendGetText("And how much mp must #v" + itemid + "# have?");
		} else if (status == 14) {
			mp = cm.getText();
			cm.sendGetText("And how much speed must #v" + itemid + "# have?");
		} else if (status == 15) {
			speed = cm.getText();
			cm.sendGetText("And how much str must #v" + itemid + "# have?");
		} else if (status == 16) {
			str = cm.getText();
			cm.sendGetText("And how much weapon attack must #v" + itemid + "# have?");
		} else if (status == 17) {
			watk = cm.getText();
			cm.sendGetText("And how much weapon defence must #v" + itemid + "# have?");
		} else if (status == 18) {
			wdef = cm.getText();
			cm.sendGetText("And how much upgradeslots must #v" + itemid + "# have?");
		} else {
			upgradeslots = cm.getText();
			cm.createEquip(itemid, acc, avoid, dex, hands, hp, intt, jump, level, luk, matk, mdef, mp, speed, str, watk, wdef, upgradeslots);
			cm.dispose();
		}
	}
}